<template>
  <PageWrapper dense>
    <CollapseContainer title="基本信息">
      <Description :column="2" :bordered="false" :data="customerInfo" :schema="schema" />
    </CollapseContainer>
  </PageWrapper>
</template>

<script setup lang="ts">
  import { toRefs } from 'vue';
  import { CollapseContainer } from '@/components/Container';
  import { PageWrapper } from '@/components/Page';
  import { DictEnum } from '@/enums/dictEnum';
  import { Description, DescItem } from '@/components/Description/index';
  import { useRender } from '@/hooks/component/useRender';
  defineOptions({ name: 'BaseInfo' });
  const { renderDict, renderRate } = useRender();
  const props = defineProps({
    customerInfo: {
      type: Object,
      default: () => ({}),
    },
  });
  const { customerInfo } = toRefs(props);
  const schema: DescItem[] = [
    {
      field: 'customerId',
      label: '客户编号',
    },
    {
      field: 'customerRating',
      label: '客户等级',
      render: (curVal) => {
        return renderRate(curVal);
      },
    },
    {
      field: 'customerName',
      label: '客户名称',
    },
    {
      field: 'customerAlias',
      label: '别名',
    },
    {
      field: 'customerCountryId',
      label: '地区',
      render: (curVal) => {
        return renderDict(curVal, DictEnum.COUNTRY);
      },
    },
    {
      field: 'customerCurrency',
      label: '币种',
      render: (curVal) => {
        return renderDict(curVal, DictEnum.CURRENCY);
      },
    },
    {
      field: 'customerCompanyTelephone',
      label: '联系电话',
    },
    {
      field: 'customerEmail',
      label: '邮箱',
    },
    {
      field: 'customerWebsite',
      label: '网站',
    },
    {
      field: 'customerSource',
      label: '来源',
      render: (curVal) => {
        return renderDict(curVal, DictEnum.CUSTOMER_SOUCE);
      },
    },
    {
      field: 'customerSetUpDate',
      label: '成立日期',
    },
    {
      field: 'test',
      label: '账单地址',
    },
    {
      field: 'remark',
      label: '备注',
    },
  ];
</script>
